import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/waterQualityMonitor',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/waterQualityMonitor/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/waterQualityMonitor',
    method: 'put',
    data
  })
}

export function getYearlyData(year) {
  return request({
    url: `api/waterQualityMonitor/yearly-data/${year}`,
    method: 'get'
  }).then(response => {
    // 将返回的数组包装为对象
    return { data: response }
  })
}


export default { add, edit, del, getYearlyData }
